package redis.inaction.xx.api;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import redis.inaction.xx.cache.SessionRedisCache;
import redis.inaction.xx.utils.ThreadLocalContext;
import redis.inaction.xx.utils.CommonResponse;

@RestController
@RequestMapping("/xx")
@Slf4j
public class XXLoginController {

    @Autowired
    private SessionRedisCache sessionRedisCache;

    @GetMapping("/loginCallback")
    public String loginCallback(){
        String uid = ThreadLocalContext.getLoginUserId();
        log.debug("login callback: {}", uid);
        return CommonResponse.successResponse(uid);
    }

    @GetMapping("/hello")
    public String hello(String name){
        return "hello, " + name;
    }
}
